const path =require('path');
const webpack =require("webpack")
const HtmlWepackPlugin = require('html-webpack-plugin')
const UglifyjswebpackPlugin =require('uglifyjs-webpack-plugin')
module.exports={
    entry:'./src/main.js',
    output:{
        path:path.resolve(__dirname,'dist'),
        filename:'bundle.js'
    },
    extendtions: ['.js','.vue','.json'],
    alias: {
        'vue$': 'vue/dist/vue.esm.js',
        '@': resolve('src'),
        'assets': resolve('src/assets'),
        'components': resolve('src/components'),
        'views': resolve('src/views')
        },
    module:{
         rules: [
          {
            test: /\.css$/,
            use: ['style-loader','css-loader']
          },
          {
            test: /.less$/,
            use:[{
                loader: "style-loader",
                 },
                {
                loader: "css-loader",   
                }
                ]
          },
          {
            test: /\.(png|jpg|gif|jpeg)$/,
            use:[
                {
                    loader: 'url-loader',
                    options: {
                        limit: 13000
                    }
                }
            ]
          }
        //   {
        //       test: //,
        //       loader: 
        //   }
        ]
    },
    resolve:{
        //extendtions: ['.js','.vue','.json'],
        alias: {
            'vue$': 'vue/dist/vue.esm.js',
            // '@': resolve('src'),
            // 'assets': resolve('src/assets'),
            // 'components': resolve('src/components'),
            // 'views': resolve('src/views')
        }
    },
    Plugins: [
        new webpack.BannerPlugin('最终版权归lzl所有'),
        new HtmlWepackPlugin({
            template: 'index.html'
        }),
        new UglifyjswebpackPlugin()
    ],
    devServer: {
        contentBase: './dist',
        inline: true
    }
}